<script setup>
  import VisualLayout from '@/components/VisualLayout.vue';
  import LineChart from '@/components/LineChart.vue';
  import BarChartCount from '@/components/BarChartCount.vue';
  import BarChartStack from '@/components/BarChartStack.vue';
  // import BarChartPictorial from '@/components/BarChartPictorial.vue';
  import BarChartPictorialCylinder from '@/components/BarChartPictorialCylinder.vue';
  import PieHuan from '@/components/PieHuan.vue';

  const PieHuanParams = ref([
    {
      statusName: '设备稼动',
      statusText: '已完成',
      value: 80,
      color: 0,
    },
    {
      statusName: '工厂稼动',
      statusText: '结束',
      value: 30,
      color: 1,
    },
    {
      statusName: '经营稼动',
      statusText: '已完成',
      value: 80,
      color: 2,
    },
    {
      statusName: '品质',
      statusText: '已完成',
      value: 60,
      color: 3,
    },
  ]);
  // setTimeout(() => {
  //   PieHuanParams.value[0] = {
  //     statusName: '工厂稼动',
  //     statusText: '结束',
  //     value: 30,
  //     color: 1
  //   }
  // }, 2000)
</script>
<template>
  <VisualLayout>
    <div class="data-box">
      <div class="data-list">
        <div class="data-item">
          <div class="count">25622</div>
          <div class="label">单日产量</div>
        </div>
        <div class="data-item">
          <div class="count">89%</div>
          <div class="label">单日达成率</div>
        </div>
        <div class="data-item">
          <div class="count">100</div>
          <div class="label">人效</div>
        </div>
      </div>

      <div class="sub-title">班别生产动态</div>

      <div class="data-list">
        <div class="data-item">
          <div class="count">20%</div>
          <div class="label">损耗率</div>
        </div>
        <div class="data-item">
          <div class="count">89%</div>
          <div class="label">目标达成率</div>
        </div>
        <div class="data-item">
          <div class="count">95%</div>
          <div class="label">合格率</div>
        </div>
      </div>
    </div>
    <div class="grid-container">
      <div class="column1">
        <!-- 第一列第一行内容 -->
        <LineChart></LineChart>
        <!-- 第一列第二行内容 -->
        <BarChartCount></BarChartCount>
      </div>
      <div class="column2">
        <!-- 第二列内容 -->
        <div class="earth-box">
          <div class="status-item center">正常生产</div>
          <div class="status-item error">设备故障</div>
          <div class="status-item running">上料等待</div>
          <div class="status-item none">无计划</div>
        </div>
        <div class="status-list">
          <PieHuan v-for="params in PieHuanParams" :params="params"></PieHuan>
        </div>
      </div>
      <div class="column3">
        <!-- 第三列第一行内容 -->
        <BarChartStack></BarChartStack>
        <!-- 第三列第二行内容 -->
        <BarChartPictorialCylinder></BarChartPictorialCylinder>
      </div>
    </div>
  </VisualLayout>
</template>

<style lang="less" scoped>
  .grid-container {
    flex: 1;
    display: flex;
    padding: 30px;
    padding-top: 0px;
    overflow: hidden;

    /* 行间距 */
    .column1,
    .column3 {
      display: flex;
      flex-direction: column;
      width: 30%;
      grid-row: span 2;
    }

    .column2 {
      width: 40%;
      grid-row: span 2;
      padding: 0px 20px;
      display: flex;
      flex-direction: column;
    }
  }

  .data-box {
    display: flex;
    justify-content: space-between;
    padding: 0px 30px;

    .sub-title {
      font-size: 22px;
      color: rgb(255, 255, 255);
      width: 687px;
      height: 68px;
      padding-bottom: 36px;
      box-sizing: border-box;
      display: flex;
      justify-content: center;
      align-items: center;
      background: url(../assets/image/sub_title_bg.png) center center no-repeat;
      background-size: 100% 100%;
    }

    .data-list {
      display: flex;
      align-items: center;
      height: 90px;

      background: url(../assets/image/data-bg.png) 0px center no-repeat;

      .data-item {
        position: relative;
        text-align: center;
        width: 160px;

        .count {
          font-size: 29px;
          font-weight: bold;
          color: #00f0ff;
          line-height: 50px;
        }

        .label {
          font-size: 15px;
          color: #f9fafa;
          line-height: 24px;
        }

        &::after {
          content: '';
          position: absolute;
          top: 50%;
          margin-top: -30px;
          right: 0px;
          width: 3px;
          height: 60px;
          background: linear-gradient(
            0deg,
            rgba(9, 39, 64, 0.1) 0%,
            rgba(53, 172, 255, 0.5) 50%,
            rgba(9, 39, 64, 0.1) 100%
          );
          border-radius: 100%;
        }

        &:nth-last-child(1) {
          &::after {
            content: none;
          }
        }
      }
    }
  }

  .earth-box {
    position: relative;
    text-align: center;
    padding-bottom: 20px;
    flex: 1;
    background: url(../assets/image/production/earth-bg.png) center center no-repeat;
    background-size: contain;

    .status-item {
      position: absolute;
      font-weight: bold;
      color: #05fec6;
      font-size: 16px;

      &.center {
        top: 22%;
        left: 50%;
        margin-left: -6%;
        font-size: 1.6rem;
        color: white;
      }

      &.error {
        top: 53%;
        left: 14.5%;
      }

      &.running {
        top: 56%;
        left: 47.5%;
      }

      &.none {
        top: 47%;
        right: 14.5%;
      }
    }

    .earth-img {
      width: 100%;
    }
  }
  .status-list {
    display: flex;
    justify-content: space-around;
  }

  @media (min-width: 1024px) {
  }
</style>
